using System;
using System.Collections.Generic;
using System.Text;

namespace QuanLyKhachSan.DTO
{
    public class KhachHangDTO
    {
        // Cac thuoc tinh
        private int maKhachHang;
        private string hoKhachHang;
        private string tenLot;
        private string tenKhachHang;
        private int maLoaiKH;
        private string diaChi;
        private string  CMND;
        private int danhDau;

        

        // Cac phuong thuc
        public int DanhDau
        {
            get { return danhDau; }
            set { danhDau = value; }
        }

        public string CMND1
        {
            get { return CMND; }
            set { CMND = value; }
        }

        public string DiaChi
        {
            get { return diaChi; }
            set { diaChi = value; }
        }

        public int MaLoaiKH
        {
            get { return maLoaiKH; }
            set { maLoaiKH = value; }
        }

        public string TenKhachHang
        {
            get { return tenKhachHang; }
            set { tenKhachHang = value; }
        }

        public string TenLot
        {
            get { return tenLot; }
            set { tenLot = value; }
        }
        public string HoKhachHang
        {
            get { return hoKhachHang; }
            set { hoKhachHang = value; }
        }

        public int MaKhachHang
        {
            get { return maKhachHang; }
            set { maKhachHang = value; }
        }

        // Kiem tra du lieu nhap vao

        // Kiem tra ho ten khach hang
        static public bool KiemTraHoTen(string chuoi)
        {
            if (string.IsNullOrEmpty(chuoi ) == false)
            {
                // Kiem tra giua 2 chu chi co khoang trang
                if (chuoi.IndexOf("  ") != -1)
                    return false;
                int i;
                // Kiem tra co ki tu ~ hay khong
                for (i = 0; i < chuoi.Length; i++)
                {
                    if (chuoi[i] == '~')
                        return false;
                }
                // Kiem tra cac ky tu dau phai ky tu hoa
                string[] arr = chuoi.Split(' ');

                for (i = 0; i < arr.Length; i++)
                {
                    if (char.IsLower(arr[i][0]) == true)
                        return false;
                }

            }
            return true  ;
        }

        // Kiem tra dia chi khach hang
        static public bool KiemTraDiaChi(string diaChi)
        {
            if (string.IsNullOrEmpty(diaChi) == false  )
            {
                // Kiem tra giua 2 chu chi co khoang trang
                if (diaChi.IndexOf("  ") != -1)
                    return false;
                // Kiem tra cac ky tu dau phai ky tu hoa
                string[] arr = diaChi.Split(' ');
                int i;
                for (i = 0; i < arr.Length; i++)
                {
                    if (char.IsLower(arr[i][0]) == true)
                        return false;
                }
            }
            return true  ;
        }

        // Kiem tra CMND cua khach hang
        static public bool KiemTraCMND(string cmnd)
        {
            if (string.IsNullOrEmpty(cmnd) == false)
            {
                // Kiem tra cmnd co dung 9 so hay khong
                if (cmnd.Length != 9)
                    return false;
                //Kiem tra cac ki tu phai la chu so
                int i;
                for (i = 0; i < cmnd.Length; i++)
                {
                    if (char.IsDigit(cmnd[0]) == false)
                        return false;
                }
            }
            return true  ;
        }
    }
}
